/**
 * <p>Copyright (c) 2017 深圳市鹏途交通科技有限公司 </p>
 * <p>				   All right reserved. 		     </p>
 * 
 * <p>项目名称 ： 	深圳市国省检日常化监管系统         </p>
 * <p>创建者   :	win7 
 * 
 * <p>描   述  :   BasicInfoMentServiceImpl.java for com.pengtu.gsj.service.impl.jsbz    </p>
 * 
 * <p>最后修改 : $: 2017年7月31日-下午2:47:46 v 1.0.0	 win7   $ </p>
 * 
*/

package com.pengtu.gsj.service.impl.jsbz;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.pengtu.gsj.dao.base.Page;
import com.pengtu.gsj.dao.base.QueryFilter;
import com.pengtu.gsj.dao.jsbz.BasicInfoMentDao;
import com.pengtu.gsj.entity.app.Attachment;
import com.pengtu.gsj.entity.jsbz.BasicInfoMent;
import com.pengtu.gsj.service.jsbz.BasicInfoMentService;
import com.pengtu.gsj.service.system.SystemManageService;

/**
 * 
 * BasicInfoMentServiceImpl
 * 
 * 2017年7月31日 下午2:47:46
 * 
 * @version 1.0.0
 * 
 */
@Service
@Transactional
public class BasicInfoMentServiceImpl implements BasicInfoMentService {
	
	@Autowired
	private BasicInfoMentDao basicInfoMentDao;
	
	@Autowired
	private SystemManageService systemManageService;
	
	
	
	@Override
	public void saveBasicInfoMent(BasicInfoMent basicInfoMent){
		basicInfoMentDao.save(basicInfoMent);
	}
	
	@Override
	public Page<BasicInfoMent> findBasicInfoMent(Page<BasicInfoMent> page, final QueryFilter queryFilter){
		return basicInfoMentDao.findPage(page, queryFilter);
	}
	
	@Override
	public BasicInfoMent getBasicInfoMentById(String id){
		return basicInfoMentDao.get(id);
	}
	
	@Override
	public void  delateBasicInfoMent(BasicInfoMent basicInfoMent){
		if(basicInfoMent.getAttachments() != null){
			for(Attachment attachment : basicInfoMent.getAttachments()){
				systemManageService.deleteAttachment(attachment);
			}
		}
		basicInfoMentDao.delete(basicInfoMent);
	}
	
	@Override
	public List<BasicInfoMent> getBasicInfoMentGroupByFileName(QueryFilter queryFilter){
		return basicInfoMentDao.find(queryFilter);
	}
	
}
